package com.demo.mangyThread.threadException.csdn;

import lombok.extern.slf4j.Slf4j;

/**
 * @Author: lkz
 * @Title: ExceptionInCurThread
 * @Description: https://blog.csdn.net/Java_zhujia/article/details/127963109
 * @Date: 2023/3/28 11:00
 */
@Slf4j
public class ExceptionInCurThread {

    public static void main(String[] args) {
        // 在当前线程捕获当前线程发生的异常
        try {
            throw new RuntimeException("在主线程抛出异常，在主线程捕获");
        } catch (RuntimeException e) {
            log.error("捕获到异常", e);
        }

    }
}
